<template>
    <div class="main">
        <div class="main-content">
            <ul class="tabs">
                <li class="tab active">推荐</li>
                <li class="tab">穿搭</li>
                <li class="tab">美食</li>
                <li class="tab">彩妆</li>
                <li class="tab">影视</li>
                <li class="tab">职场</li>
                <li class="tab">情感</li>
                <li class="tab">家居</li>
                <li class="tab">游戏</li>
                <li class="tab">旅行</li>
                <li class="tab">健身</li>
            </ul>
            <div class="img-content" :style="{height: imgContentHeight + 'px'}">
                <div class="img-item" v-for="item in cardList" :key="item.id">
                    <TemplateImg :data="item"/>
                </div>
            </div>
        </div>
    </div>
</template>

<script setup lang="ts">
import { computed, watch } from 'vue';
import TemplateImg from './templateImg.vue';
import { useGlobalStore } from '@/store/global'

const globalStore = useGlobalStore()

const cardList = computed(() => globalStore.cardList)
const imgContentHeight = computed(() => globalStore.clientHeight)
</script>

<style scoped lang="scss">
.main {
    margin-top:72px;
    width: 100%;
    padding-left: var(--content-left);
    overflow-x: hidden;
    background-color: var(--color-background);

    .main-content {
        width: 100%;
        padding: 0 var(--gap);
        overflow: hidden;

        .tabs{
            display: flex;
            list-style: none;
            padding: 0;
            min-width: 800px;
            width: 100%;
            .tab{
                padding: 0 16px;
                border-radius: var(--border-radius);
                height: 40px;
                line-height: 40px;
                text-align: center;
                cursor: pointer;

                &:hover{
                    background-color: var(--color-active-background);
                }

                &.active{
                    background-color: var(--color-active-background);
                    font-weight: 600;
                }
            }
        }

        .img-content{
            position: relative;
        }

        .img-item{
            position: absolute;
            left: 0;
            top: 0;
            //transition: all .4s;
        }
    }
}
</style>